#!/usr/bin/env python

import sys

def encode(input):
	lastAppend = "0"
	encoded = ""
	array = list(input)[::-1]

	for i in range(0, len(array)):
		current = array[i]

		if current == "0":
			if lastAppend == "1":
				lastAppend = "0"
			else:
				lastAppend = "1"

		encoded += lastAppend

	return encoded[::-1]

if len(sys.argv) == 2:
	print encode(sys.argv[1])
else:
	f = open('./sim.dat')

	for line in f.readlines():
		encoded = encode(str(line))

		print encoded
